Belgelerim/ceng_491/implementation/doxygen/TraffEdu_Developers_Manual_Reference_ToSource/LightForm.cpp

Go to the documentation of this file.
00001 // LightForm.cpp : implementation file
00002 //
00003 /*
00004 *
00005 * This is the LigtForm for the traffic lights part of the
00006 * toolbox of the Scenario Editor.
00007 * The corresponding form view can be seen in the resources view 
00008 * as IDD_LIGHTFORM.
00009 *
00010 *************************************/
00011 
00012 #include "stdafx.h"
00013 #include "TraffEdu.h"
00014 #include "LightForm.h"
00015 #include "SignForm.h"
00016 #include "RoadForm.h"
00017 #include "EnvObjectsForm.h"
00018 #include "splitter.h"
00019 #include "VehicleForm.h"
00020 #include ".\lightform.h"
00021 #include "Enumarations.h"
00022 #include "MainFrm.h"
00023 
00024 
00025 
00026 IMPLEMENT_DYNCREATE(LightForm, CFormView)
00027 
00028 LightForm::LightForm()
00029         : CFormView(LightForm::IDD)
00030 {
00031         iconNormalRedLight1 = static_cast<HICON>(LoadImage (theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON4),
00032                                                                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR)); 
00033 
00034         
00035         iconNormalYellowLight2 = static_cast<HICON>(LoadImage (theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON5),
00036                                                                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR)); 
00037         
00038         iconNormalGreenLight3 =  static_cast<HICON>(LoadImage (theApp.m_hInstance, MAKEINTRESOURCE(IDI_ICON7),
00039                                                                         IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR)); 
00040 }
00041 
00042 LightForm::~LightForm()
00043 {
00044 }
00045 
00046 void LightForm::DoDataExchange(CDataExchange* pDX)
00047 {
00048         CFormView::DoDataExchange(pDX);
00049         DDX_Control(pDX, IDC_BUTTON5, redNormalLightButton1);           //Red Light Button1
00050         DDX_Control(pDX, IDC_BUTTON6, yellowNormalLightButton2);        //Yellow Light Button2
00051         DDX_Control(pDX, IDC_BUTTON7, greenNormalLightButton3);         //Green Light Button3
00052 
00053 }
00054 
00055 BEGIN_MESSAGE_MAP(LightForm, CFormView)
00056         ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButton1)
00057         ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
00058         ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
00059         ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton5)
00060         ON_BN_CLICKED(IDC_BUTTON6, OnBnClickedButton6)
00061         ON_BN_CLICKED(IDC_BUTTON7, OnBnClickedButton7)
00062         ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
00063         ON_BN_CLICKED(IDC_BUTTON8, OnBnClickedButton8)
00064 END_MESSAGE_MAP()
00065 
00066 
00067 // LightForm diagnostics
00068 
00069 #ifdef _DEBUG
00070 void LightForm::AssertValid() const
00071 {
00072         CFormView::AssertValid();
00073 }
00074 
00075 void LightForm::Dump(CDumpContext& dc) const
00076 {
00077         CFormView::Dump(dc);
00078 }
00079 #endif //_DEBUG
00080 
00081 
00082 // LightForm message handlers
00083 
00084 void LightForm::OnInitialUpdate()
00085 {
00086         CFormView::OnInitialUpdate();
00087         redNormalLightButton1.SetIcon (iconNormalRedLight1);
00088         yellowNormalLightButton2.SetIcon(iconNormalYellowLight2);
00089         greenNormalLightButton3.SetIcon(iconNormalGreenLight3);
00090 
00091 }
00092 //The first button of the LightForm view is for switching to RoadForm
00093 
00094 void LightForm::OnBnClickedButton1()
00095 {
00096         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00097         pParentSplitter->ReplaceView(RUNTIME_CLASS(RoadForm));
00098 
00099         
00100 }
00101 
00102 //The second button of the LightForm view is for switching to VehicleForm
00103 
00104 void LightForm::OnBnClickedButton2()
00105 {
00106         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00107         pParentSplitter->ReplaceView(RUNTIME_CLASS(VehicleForm));
00108 
00109         
00110 }
00111 
00112 //The fourth button of the LightForm view is for switching to SignForm
00113 
00114 void LightForm::OnBnClickedButton4()
00115 {
00116         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00117         pParentSplitter->ReplaceView(RUNTIME_CLASS(SignForm));
00118 
00119         
00120 }
00121 
00122 //The fifth button of the LightForm view is to pass to draw red traffic light mode.
00123 
00124 void LightForm::OnBnClickedButton5()
00125 {
00126         
00127         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00128 
00129         CMainFrame *pFrame = reinterpret_cast<CMainFrame*>(pParentSplitter->GetParentFrame());
00130         
00131         pFrame->drawMode = DRAW_TRAFFIC_LIGHT;
00132         pFrame->lightColor = KIRMIZI;
00133         pFrame->lightType = NORMAL_ISIK;
00134 }
00135 
00136 //The sixth button of the LightForm view is to pass to draw yellow traffic light mode.
00137 
00138 void LightForm::OnBnClickedButton6()
00139 {
00140 
00141         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00142 
00143         CMainFrame *pFrame = reinterpret_cast<CMainFrame*>(pParentSplitter->GetParentFrame());
00144         
00145         pFrame->drawMode = DRAW_TRAFFIC_LIGHT;
00146         pFrame->lightColor = SARI;
00147         pFrame->lightType = NORMAL_ISIK;
00148 
00149 
00150 }
00151 
00152 //The seventh button of the LightForm view is to pass to draw green traffic light mode.
00153 
00154 void LightForm::OnBnClickedButton7()
00155 {
00156         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00157         
00158         CMainFrame *pFrame = reinterpret_cast<CMainFrame*>(pParentSplitter->GetParentFrame());
00159 
00160         pFrame->drawMode = DRAW_TRAFFIC_LIGHT;
00161         pFrame->lightColor = YESIL;
00162         pFrame->lightType = NORMAL_ISIK;
00163 
00164         
00165 }
00166 
00167 void LightForm::OnBnClickedButton3()
00168 {
00169 }
00170 
00171 void LightForm::OnBnClickedButton8()
00172 {
00173         
00174         C4WaySplitter* pParentSplitter = (C4WaySplitter*)GetParent();
00175         pParentSplitter->ReplaceView(RUNTIME_CLASS(EnvObjectsForm));
00176         
00177 }

Generated on Sun May 28 18:54:09 2006 for TraffEdu by  doxygen 1.4.6-NO